package icu.funkye.confine.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author jianbin.chen
 */
@Component
@ConfigurationProperties(prefix = ConfineProperties.CONFINE_PREFIX)
public class ConfineProperties {

    public static final String CONFINE_PREFIX = "confine";

    private boolean enable = true;

    private Integer globalMaxTps = 1000;

    private String type = "bucket";

    /**
     * 平均rt阈值,单位毫秒,默认1秒,1分钟内平局rt达到此值后进行熔断
     */
    private Long globalMaxRtThreshold = 100 * 10L;

    public Integer getGlobalMaxTps() {
        return globalMaxTps;
    }

    public void setGlobalMaxTps(Integer globalMaxTps) {
        this.globalMaxTps = globalMaxTps;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public Long getGlobalMaxRtThreshold() {
        return globalMaxRtThreshold;
    }

    public void setGlobalMaxRtThreshold(Long globalMaxRtThreshold) {
        this.globalMaxRtThreshold = globalMaxRtThreshold;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
